关于用ASP做的"故事接龙"实现不了

来源:百度知道 编辑:UC知道 时间:2024/07/02 18:55:34
我在ASP中的书中抄的全段代码,但是实现不了,大家帮我看一看
<html>
<head><title>在线故事接龙</title></head>
<body>
<hr>
<%set myfileobject=server.createobject("scripting.filesystemobject")
set mytextfile=myfileobject.opentextfile("thestory.txt".1,true)
while not mytextfile.atendofstream
response.write("  "&mytextfile.readline)
wend
mytextfile.close
%>
<hr>
<h3>请输入这个故事的新行:</h3>
<form action="story.asp" method="post">
<input name="nextline" type=text size=70>
<input type=submit value="确认添加这一句"
</form>
</body>
</html>

STORY.ASP

<%
if not request.form("nextline")="" then
set myfileobject=server.createobject("scripting.filesystemobject")
set mytextfile=myfileobject.opentextfile("the

有的空间禁止了filesystemobject,所以不能使用
你的这个说没有权限,可能是因为你创建文件的位置有问题
建议把这句
set mytextfile=myfileobject.opentextfile("thestory.txt",8,true)
修改成
set mytextfile=myfileobject.opentextfile(server.mappaht("./")+"\"+"thestory.txt",8,true)
个人建议使用application实现
<html>
<head><title>在线故事接龙</title></head>
<body>
<hr>
<%=application("story")%>
<hr>
<h3>请输入这个故事的新行:</h3>
<form action="story.asp" method="post">
<input name="nextline" type=text size=70>
<input type=submit value="确认添加这一句"
</form>
</body>
</html>

STORY.ASP

<%
if not request.form("nextline")="" then
application("story")=application("story")+request.form("nextline"